#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
	ll n;
	cin >> n;
	vector<int> a(n + 1);
	for (int i = 1; i <= n;i++)
	{
		cin >> a[i];
	}
	int m;
	cin >> m;
	while (m--)
	{
		vector<int> b(n + 1);
		bool flag = false;
		for (int i = 1; i <= n;i++)
		{
			cin >> b[i];
		}
		for (int i = 1; i <= n;i++)
		{
			if ((a[i] == b[i] && a[i] == 1) || (a[i] == b[i] && a[i] == 2))
			{
				flag = true;
			}
			else if(b[i]==0)
			{
				continue;
			}
			else {
				flag = false;
				break;
			}
		}
		if (flag)
		{
			cout << "Da Jiang!!!" << endl;
		}
		else
		{
			cout << "Ai Ya" << endl;
		}
	}
	return 0;
}
